home *** CD-ROM | disk | FTP | other *** search
- #include <exec/exec.h>
- #include <dos/datetime.h>
- #include <dos.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <clib/dos_protos.h>
- #include <clib/exec_protos.h>
- #include <string.h>
- #include "work:romconf/doorheader.h"
- #include "source:aztec/glue.h"
- int mynode;
- char string[200];
- char temp[200];
- void end(void);
- void LastCommand(void);
- #define sm sendmessage
- #define hk hotkey
- #define pm prompt
- #define pu putuserstring
- #define gu getuserstring
- void sr(char *s);
- void GetFileDate(char *s);
- char Path[200];
- char Dat[20];
- char DatTime[20];
- char DatSize[20];
- char Temp1[20];
- char tempname[200];
- char Name[200];
- char t[200];
- char p[200];
- char RegNum[40];
- char tempname1[200];
- char OutPutName[200];
- int FindIt(char *str,char *FileName);
- void Prepare();
- #define TX(x) (UBYTE)Number.Text[x]
- int PurgeIt(char *str,char *FileName,char *NewName);
- void Serialize(void);
- long lock=NULL;
- struct REGIT
- {
- char Text[8];
- long chksum;
- };
- struct REGIT Number;
- main(int argc,char *argv[])
- {
- int i;
- FILE *fi,*st;
- if(argc!=2)
- {
- printf("AutoRegister version 2.2, written by Joseph Hodge\n");
- printf("\n\n");
- exit(0);
- }
- Register(argv[1][0]-'0');
- mynode=argv[1][0]-'0';
- strcpy(Path,argv[0]);
- i=strlen(Path)-1;
- while(Path[i]!='/' && Path[i]!=':') i--;
- Path[i+1]='\0';
- sm("",1);
- sm("AutoRegister 2.2, written by Joseph Hodge",1);
- sm("",1);
- sprintf(tempname,"%sLockme",Path);
- if(!(lock=Lock(tempname,ACCESS_WRITE)))
- {
- sm("",1);
- sm("Sorry but an Update is currently being give on another node",1);
- sm("Please try again in a few minutes",1);
- ShutDown();
- end();
- }
-
- gu(Name,DT_NAME);strupr(Name);
- strcpy(t,"VALIDATE");
- pu(t,RETURNCOMMAND);
- Chain("DOORS:FORMEDIT/FORMEDIT",argv[1][0]-'0',WAIT);
- strcpy(t,"");
- pu(t,RETURNCOMMAND);
- sprintf(tempname,"Registered:Validate/Validate.db",Path);
- if(!FindIt(Name,tempname))
- {
- sm("You must complete the validation FORM.",1);
- sm("Aborting registration.",1);
- ShutDown();
- end();
- }
-
-
- sm("Version stats",1);
- sm("-------------",1);
- sprintf(string,"version >ram:%dver.txt %sexpress FULL\n",mynode,Path);
- Execute(string,NULL,NULL);
- sprintf(string,"%sexpress",Path);
- if(!access(string,00))
- sprintf(string,"ram:%dver",mynode); else strcpy(string,"");
- sm(" 1>/X Express : ",0); showgfile(string);
- sprintf(string,"%sexpress",Path); GetFileDate(string);
- sprintf(string,"%s %s %s",Dat,DatTime,DatSize);
- if(string[0]!=' ')sm(" : ",0); sm(string,1);
- sm("",1);
-
- sprintf(string,"version >ram:%dver.txt %sacp FULL\n",mynode,Path);
- Execute(string,NULL,NULL);
- sprintf(string,"%sacp",Path);
- if(!access(string,00))
- sprintf(string,"ram:%dver",mynode); else strcpy(string,"");
-
- sm(" 2>/X ACP : ",0); showgfile(string);
- sprintf(string,"%sACP",Path); GetFileDate(string);
- sprintf(string,"%s %s %s",Dat,DatTime,DatSize);
- if(string[0]!=' ')sm(" : ",0); sm(string,1);
- sm("",1);
-
- sprintf(string,"%sBBS.DOX",Path); GetFileDate(string);
- sprintf(string,"%s %s %s",Dat,DatTime,DatSize);
- sm(" 3>/X DOX : ",0); sm(string,1);
-
- sprintf(string,"%sBBS.LZH",Path); GetFileDate(string);
- sprintf(string,"%s %s %s",Dat,DatTime,DatSize);
- sm(" 4>/X Package : ",0); sm(string,1);
- sm("-------------",1);
-
- while(1)
- {
- sm("",1);
- sm("Select Item to download or 'Q' to Quit >:",0);
- hk("",string);
- switch(string[0])
- {
-
- case '1':
- sm("1.",1);
-
- sprintf(string,"%sexpressx000",Path);
- if(!access(string,00))
- {
- Serialize();
- hk("press anykey to begin download",temp);sm("",1);
- Download(string);
- }else sm("Sorry, this file is not available at this time",1);
- break;
-
- case '2':
- sm("2.",1);
-
- sprintf(string,"%sacp.ctrl",Path);
- if(!access(string,00))
- {
- hk("press anykey to begin download",temp);sm("",1);
- Download(string);
- }else sm("Sorry, this file is not available at this time",1);
- break;
- case '3':
- sm("3.",1);
-
- sprintf(string,"%sBBS.DOX",Path);
- if(!access(string,00))
- {
- hk("press anykey to begin download",temp);sm("",1);
- Download(string);
- }else sm("Sorry, this file is not available at this time",1);
-
- break;
- case '4':
- sm("4.",1);
- sprintf(string,"%sBBS.LZH",Path);
- if(!access(string,00))
- {
- hk("press anykey to begin download",temp);sm("",1);
- Download(string);
- }else sm("Sorry, this file is not available at this time",1);
-
- break;
-
- case 'Q':
- case 'q':
- sm("",1);
- sm("",1);
- //sm(" IMPORTANT FACTS: Any version of express that you may download",1);
- //sm(" via this door is strictly BETA, don't spread this, it may do more",1);
- //sm(" harm than good",1);
- //sm("",1);
- //sm("",1);
-
- ShutDown(); end();
- }
-
- }
-
-
- }
- void end(void)
- {
- exit(0);
- }
- void LastCommand(void)
- {
- char temp[200];
- sprintf(temp,"ram:%dver",mynode);
- DeleteFile(temp);
- sprintf(temp,"%sInfo",Path);
- showgfile(temp);
- if(lock) UnLock(lock);
-
- }
- void GetFileDate(char *s)
- {
- struct FileInfoBlock *FBlock;
- struct DateTime d;
- BPTR FLock;
- strcpy(Dat,"");
- strcpy(DatTime,"");
- strcpy(DatSize,"");
-
- if((FLock=Lock(s,ACCESS_READ)))
- {
- FBlock=AllocMem((long)sizeof(struct FileInfoBlock),MEMF_CHIP);
- Examine(FLock,FBlock);
- UnLock(FLock);
- sprintf(DatSize,"%ld",FBlock->fib_Size);
- d.dat_Stamp=FBlock->fib_Date;
- d.dat_StrDate=&Dat;
- d.dat_StrTime=&DatTime;
- d.dat_Format=FORMAT_USA;
- d.dat_StrDay=0;
- d.dat_Flags=0;
- DateToStr(&d);
- FreeMem(FBlock,sizeof(struct FileInfoBlock));
- }
- }
- int FindIt(char *str,char *FileName)
- {
- FILE *fi;
- char image[200];
- if(!TLock(FileName)) return(0);
- strupr(str);
- fi=fopen(FileName,"r");
- while(fgets(image,80,fi)!=NULL)
- {
- sr(image);
- strupr(image);
- if(!strcmp(image,str))
- {
- fclose(fi);
- return(1);
- }
- }
- fclose(fi);
- return(0);
- }
- int PurgeIt(char *str,char *FileName,char *NewName)
- {
- FILE *fi,*fo1,*fo2;
- char image[200];
- int returncode=0;
- if(!TLock(FileName)) return(0);
- sprintf(image,"%s.tmp",FileName);
- if(!TLock(image))
- {
- Rename(FileName,image);
- }
- strupr(str);
- fi=fopen(image,"r");
- fo1=fopen(FileName,"w");
- fo2=fopen(NewName,"a");
- while(fgets(image,80,fi)!=NULL)
- {
- sr(image);
- strupr(image);
- if(!strcmp(image,str))
- {
- fprintf(fo2,"%s\n",image);
- returncode=1;
-
- }
- else fprintf(fo1,"%s\n",image);
- }
- fclose(fi);
- fclose(fo1);
- fclose(fo2);
- sprintf(image,"%s.tmp",FileName);
-
- DeleteFile(image);
- return(returncode);
- }
- void sr(char *str)
- {
- register int i;
- i=strlen(str)-1;
- while(i>-1)
- {
- if(*(str+i)<=32) *(str+i)='\0'; else break;
- i--;
- }
- }
- void Serialize(void)
- {
- int i=0;
- FILE *fi,*st;
- static int j=0;
- if(!j)
- {
- sprintf(tempname,"%sUpdate.Dat",Path);
- if(!FindIt(Name,tempname))
- {
- Number.chksum=time(NULL);
- sprintf(OutPutName,"%sUpdate.Dat",Path);
- st=fopen(OutPutName,"a");
- fprintf(st,"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
- fprintf(st,"%s\n",Name);
- fprintf(st,"CheckSum %ld ",Number.chksum);
- fprintf(st,"SumKickDate %s",ctime(&Number.chksum));
- fprintf(st,"REG:%s-%u%u%u%u%u%u%u%u%u-%u.%u%u\n",Name,TX(11),TX(1),TX(9),TX(3),TX(4),TX(8),TX(6),TX(7),TX(5),TX(2),TX(10),TX(0));
- fclose(st);
- sm("",1);
- sprintf(p,"%u%u%u%u%u%u%u%u%u-%u.%u%u",TX(11),TX(1),TX(9),TX(3),TX(4),TX(8),TX(6),TX(7),TX(5),TX(2),TX(10),TX(0));
- sm("Your Registration number is >:",0);
- sm(p,0);sm("",1);sm("",1);
- sm("Please record your Registration number, It will be needed to get",1);
- sm("product assistance and future updates.",1);
- sm("",1);
- hotkey("Press (enter) to continue",tempname);
- sm("",1);
- }
- else
- {
- pm("Please Enter registration number >:",RegNum,30);
- strcpy(p,RegNum);
- sprintf(t,"REG:%s-%s",Name,RegNum); strupr(t);
- sprintf(tempname,"%sUpdate.dat",Path);
- sprintf(tempname1,"%sUpdate.old",Path);
-
- if(!FindIt(t,tempname))//,tempname1))
- {
- sm("",1);
- sm("Records indicate that this is an invalid Registration.",1);
- sm("Please leave a message with the sysop for further assistance.",1);
- sm("",1);
- ShutDown();
- end();
- }
- /*
- Number.chksum=time(NULL);
- sprintf(OutPutName,"%sUpdate.dat",Path);
- st=fopen(OutPutName,"a");
- fprintf(st,"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
- fprintf(st,"%s\n",Name);
- fprintf(st,"CheckSum %ld ",Number.chksum);
- fprintf(st,"SumKickDate %s",ctime(&Number.chksum));
- fprintf(st,"REG:%s-%u%u%u%u%u%u%u%u%u-%u.%u%u\n",Name,TX(11),TX(1),TX(9),TX(3),TX(4),TX(8),TX(6),TX(7),TX(5),TX(2),TX(10),TX(0));
- fclose(st);
- sm("",1);
- sprintf(p,"%u%u%u%u%u%u%u%u%u-%u.%u%u",TX(11),TX(1),TX(9),TX(3),TX(4),TX(8),TX(6),TX(7),TX(5),TX(2),TX(10),TX(0));
- sm("Your New Registration number is >:",0);
- sm(p,0);sm("",1);sm("",1);
-
- sm("Please record your Registration number, It will be needed to get",1);
- sm("product assistance and future updates.",1);
- sm("",1);
- */
- hotkey("Press (enter) to continue",tempname);
- sm("",1);
- }
- j=1;
- }
- sm("",1);
- sm(" STANDBY serializing file",1);
- for(i=0;i<strlen(p);i++)
- {
- sm(".",0); Delay(30L);
- }
- sm("",1);
- sm("",1);
- }